<?php

namespace app\controller\system;

use app\BaseController;
use think\response\Json;

class Operation extends BaseController
{
    public function save(): Json
    {
        return $this->handle(function (){
            return $this->app->make(\app\model\StationOperation::class)->insertData();
        });
    }

    public function lst(): Json
    {
        return $this->handle(function (){
            return $this->app->make(\app\model\StationOperation::class)->pageData();
        });
    }

    public function detail(): Json
    {
        return $this->handle(function (){
            $data = $this->app->make(\app\model\StationOperation::class)->where('id',$this->request->param('id'))->find();
            if(!empty($data)) {
                $data = $data->toArray();
                $data['content'] = htmlspecialchars_decode($data['content']);
            }
            return $data;
        });
    }
}
